import React, { useReducer } from 'react';
import { reducer, initState } from "../../pages/Login/user";
import {Route,Redirect} from "react-router-dom";

export default function PrivateRoute(props) {
    const [state, dispatch] = useReducer(reducer, initState);
    let info = sessionStorage.getItem("info")
    return (
        <div>
            {info ?<Route {...props}></Route>:<Redirect to="/login"></Redirect>}
        </div>
    )
}
